package com.easylinkin.linkappapi.knowledgebase.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easylinkin.linkappapi.knowledgebase.entity.KnowledgeBase;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 知识库表 Mapper 接口
 * </p>
 *
 * @author xy
 * @since 2021-12-02
 */
public interface KnowledgeBaseMapper extends BaseMapper<KnowledgeBase> {

  IPage<KnowledgeBase> getKnowledgeBasePage(Page page, @Param("base") KnowledgeBase knowledgeBase);

  List<KnowledgeBase> findByTypeIdAndTenantId(@Param("typeId") Long typeId,
      @Param("tenantId") String tenantId);

  List<KnowledgeBase> findByTypeIdAndNameAndTenantId(@Param("typeId") Long typeId,
      @Param("name") String name, @Param("tenantId") String tenantId);

  Integer countKnowledgeByTypeIdAndUserIdAndTenantId(@Param("typeId") Long typeId,
      @Param("userId") Long userId, @Param("tenantId") String tenantId);

}
